#ifndef __BS_CONF_H_
#define __BS_CONF_H_

#include <stdio.h>
#include "bs_common.h"
#include "bs_struct.h"
#include "bs_def.h"
#include "bs_error.h"

#ifdef __cplusplus
extern "C"{
#endif

typedef struct{
    char        name[BS_SHORT_STRLEN];
    char        value[BS_DEF_STRLEN];
}_conf_elem_t;

typedef struct{
    array_t(_conf_elem_t)       list;
}bs_conf_t;

int bs_conf_read(bs_conf_t* pconf, const char* path);
const char* bs_conf_getstr(const bs_conf_t* pconf, const char* name);
int bs_conf_getint(const bs_conf_t* pconf, const char* name);
size_t bs_conf_size(const bs_conf_t* pconf);
const char* bs_conf_getname(const bs_conf_t* pconf, uint32_t i);
const char* bs_conf_getstr_idx(const bs_conf_t* pconf, uint32_t i);
int bs_conf_getint_idx(const bs_conf_t* pconf, uint32_t i);
#define bs_conf_destroy(conf)   array_destroy(&(conf)->list)

#ifdef __cplusplus
}
#endif
#endif
